from django.shortcuts import render_to_response

from models import Article, Author

from rtdt.decorators import rtdt_cache_page

# Create your views here.

@rtdt_cache_page(timeout=10000)
def article_view(request, id):
    print "Rendering an article_view for '%s'" % id
    a = Article.objects.get(id=id)
    authors = Author.objects.all()
    return render_to_response('article.html',
                              {'article': a,
                               'authors': authors,
                               })

@rtdt_cache_page(timeout=10000)
def author_view(request, id):
    print "Rendering an author_view for '%s'" % id
    a = Author.objects.get(id=id)
    return render_to_response('author.html',
                              {'author': a,
                               })
